// createRouter 用来新建路由实例，createWebHashHistory 用来配置我们内部使用 hash 模式的路由，也就是 url 上会通过 # 来区分。
import {
	createRouter,
	createWebHashHistory,
	RouterView
} from "vue-router";

const routes = [{
	path: '/',
	redirect: '/index',
}, {
	path: "/login",
	name: "Login",
	component: () => import('@/views/login/login.vue'),
}, {
	path: "/index",
	name: "Index",
	meta: {
		title: "首页",
		isNav: true, //开启导航菜单（非菜单渲染数据放在外面同级）
	},
	component: () => import('@/views/home.vue'),
	// 需要渲染到导航组件的放在一个list中
	children: [{
		path: '/index',
		name: 'Index',
		meta: {
			title: "首页",
			icon: 'index',
			isMenu: true, //是否展示在导航侧边栏
			isBig: false, //初始化是否折叠导航栏（针对大屏项目首页折叠导航栏，纯后台管理系统则设置为false）
		},
		component: () => import('@/views/index/index.vue'),
	}, {
		path: "/echarts",
		meta: {
			title: "常用功能",
			icon: 'index',
			isMenu: true //是否展示在导航侧边栏
		},
		component: RouterView,
		children: [{
			path: '/echarts',
			name: 'Echarts',
			meta: {
				title: "echarts",
				icon: 'index',
				isMenu: true //是否展示在导航侧边栏
			},
			component: () => import('@/views/demo/echarts.vue'),
		}, {
			path: '/table',
			name: 'Table',
			meta: {
				title: "表格",
				icon: 'index',
				isMenu: true //是否展示在导航侧边栏
			},
			component: () => import('@/views/demo/table.vue'),
		}, {
			path: '/amap',
			name: 'Amap',
			meta: {
				title: "高德地图",
				icon: 'index',
				isMenu: true //是否展示在导航侧边栏
			},
			component: () => import('@/views/demo/amap.vue'),
		}, {
			path: '/wangeditor',
			name: 'Wangeditor',
			meta: {
				title: "富文本编辑器",
				icon: 'index',
				isMenu: true //是否展示在导航侧边栏
			},
			component: () => import('@/views/demo/wangeditor.vue'),
		}, {
			path: '/upload',
			name: 'Upload',
			meta: {
				title: "图片上传",
				icon: 'index',
				isMenu: true //是否展示在导航侧边栏
			},
			component: () => import('@/views/demo/upload.vue'),
		}]
	}, {
		path: "/test21",
		meta: {
			title: "测试菜单二",
			icon: 'index',
			isMenu: true //是否展示在导航侧边栏
		},
		component: RouterView,
		children: [{
			path: '/test21',
			name: 'Test21',
			meta: {
				title: "测试菜单2-1",
				icon: 'index',
				isMenu: true //是否展示在导航侧边栏
			},
			component: () => import('@/views/test2/test21.vue'),
		}, {
			path: '/test22',
			name: 'Test22',
			meta: {
				title: "测试菜单2-2",
				icon: 'index',
				isMenu: true //是否展示在导航侧边栏
			},
			component: () => import('@/views/test2/test22.vue'),
		}]
	}, {
		path: "/test3",
		meta: {
			title: "低代码实现",
			icon: 'index',
			isMenu: true //是否展示在导航侧边栏
		},
		component: () => import('@/views/test3/test3.vue'),
	}, {
		path: "/test4",
		meta: {
			title: "三方反显",
			icon: 'index',
			isMenu: true //是否展示在导航侧边栏
		},
		component: () => import('@/views/test4/test3.vue'),
	}, {
		path: "/test5",
		meta: {
			title: "myLowCode反显",
			icon: 'index',
			isMenu: true //是否展示在导航侧边栏
		},
		component: () => import('@/views/test5/test3.vue'),
	}, {
		path: "/test6",
		meta: {
			title: "拖拽布局",
			icon: 'index',
			isMenu: true //是否展示在导航侧边栏
		},
		component: () => import('@/views/test6/test3.vue'),
	}, {
		path: "/test7",
		meta: {
			title: "汉语拼音/echarts-gl纹理",
			icon: 'index',
			isMenu: true //是否展示在导航侧边栏
		},
		component: () => import('@/views/test7/test3.vue'),
	}, {
		path: "/test8",
		meta: {
			title: "模板编辑",
			icon: 'index',
			isMenu: true //是否展示在导航侧边栏
		},
		component: () => import('@/views/test8/test3.vue'),
	}, {
		path: "/lowCodeForm",
		meta: {
			title: "新建编辑",
			icon: 'index',
			isMenu: false //是否展示在导航侧边栏
		},
		component: () => import('@/views/test8/lowCodeForm.vue'),
	}, {
		path: "/lowCodeFormList",
		meta: {
			title: "表单编辑",
			icon: 'index',
			isMenu: false //是否展示在导航侧边栏
		},
		component: () => import('@/views/test8/lowCodeFormList.vue'),
	}, {
		path: "/test9",
		meta: {
			title: "测试菜单9",
			icon: 'index',
			isMenu: true //是否展示在导航侧边栏
		},
		component: () => import('@/views/test9/test3.vue'),
	}, {
		path: "/test10",
		meta: {
			title: "测试菜单10",
			icon: 'index',
			isMenu: true //是否展示在导航侧边栏
		},
		component: () => import('@/views/test10/test3.vue'),
	}],
}, {
	path: "/404",
	name: "404",
	component: () => import('@/views/404.vue'),
}, {
	path: '/:pathMatch(.*)',
	redirect: '/404',
}]

const router = createRouter({
	routes,
	history: createWebHashHistory(),
})

export default router